﻿using CServiceStack.ProtoBuf;
using CServiceStack.ProtoBuf.Meta;
using CServiceStack.ServiceHost;
using CServiceStack.WebHost.Endpoints;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SomeServices
{
    public class SomeProtobufFormat : IPlugin
    {
        public void Register(IAppHost appHost)
        {
            appHost.ContentTypeFilters.Register("application/someprotobuf",new StreamSerializerDelegate((ctx,dto,stream)=> Serializer.NonGeneric.Serialize(stream,dto)), Serializer.NonGeneric.Deserialize);
            RuntimeTypeModel.Default.InferTagFromNameDefault = true;
        }

    }
}
